package Text;

class Animal{
    //代码块以及构造方法执行顺序
    String name;
    int age;
    {
        System.out.println("父类构造代码块");
    }
    static {
        System.out.println("父类静态代码块");
    }
    public Animal(){
        System.out.println("父类构造方法");
    }
}
class Dog extends Animal{
    int age;

    static {
        System.out.println("子类静态代码块");
    }
    public Dog(){

        System.out.println("子类构造方法");
    }
    {
        System.out.println("子类构造代码块");
    }
}
public class Text3 {
    public static void main(String[] args) {
        Dog dog=new Dog();
    }
}
